<template>
  <div class="co-radio-group">
    <slot></slot>
  </div>
</template>

<script>

export default {
  name: 'co-radioGroup',
  data () {
    return {}
  },
  methods: {
    updateCheckedValue () {
      this.$children.forEach(item => {
        item.checkedValue = this.value
      })
    },
    trigger (eventType, value) {
      this.$emit(eventType, value)
    }
  },
  props: ['value'],
  mounted () {
    // console.log(this.$children)
    // 1
    // this.$children[0].checkedValue = this.value
    this.updateCheckedValue()
  },
  watch: {
    value () {
      this.updateCheckedValue()
    }
  }
}
</script>

<style scoped lang=scss>
  *{
    margin: 0px;
    padding: 0px;
  }
  .co-radio-group{
    padding: 20px 0px;
  }
</style>
